import { Card } from 'antd';
import React from 'react';
import styles from './index.less';
import DirectoryTree from '@/components/Folder';

const initData = [
  {
    title: 'Word',
    key: 'docx',
    isLeaf: true,
  },
  {
    title: 'Excel',
    key: 'xlsx',
    isLeaf: true,
  },
  {
    title: 'PPT',
    key: 'pptx',
    isLeaf: true,
  },
];

const FileTypeTree = (props) => {
  const { onNodeSelect } = props;

  const onSelect = (node) => {
    if (onNodeSelect) {
      onNodeSelect(node.key);
    }
  };

  return (
    <Card
      title="类型"
      size="small"
      bordered={false}
      className={styles.sidebar}
      style={{ width: 300 }}
    >
      <DirectoryTree treeData={initData} onNodeSelect={onSelect} />
    </Card>
  );
};

export default FileTypeTree;
